package com.kgc.polym.demo1;

import java.text.MessageFormat;

public class Penguin extends Pet{
    private String sex;//性别

    public Penguin() {

    }

    public Penguin(String nickName, int health, int love, int liveness, String sex) {
        super(nickName, health, love, liveness);
        this.setSex(sex);
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }
    /**
     * 重写父类显示宠物详细信息方法
     */
    @Override
    public void showDetails() {
        String message = MessageFormat.format
            ("宠物的自白:\n我的名字叫{0},我的健康值是{1},我和主人的亲密度是{2},活跃度是{3},我的性别是{4}",
                    super.getNickName(),super.getHealth(),super.getLove(),super.getLiveness(),this.getSex());
        System.out.println(message);
    }
}
